/*
 * AGENT SHERPA
 *  
 * Assignement 2 of the Agent Oriented Software Engineering Course
 * M.Sc. in Advanced Software Engineering (Part-time)
 * University College Dublin www.ucd.ie
 *
 * Copyright (c) 2007 Chris Walsh, Aidan Morrisy and Iain Hull.
 * All rights reserved.
 * 
 * Filename: Main.aps
 * Author:   iain
 * Date:     06 February 2008
 */

package org.agentsherpa.ui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.net.MalformedURLException;
import java.net.URL;

import javax.swing.JFrame;

import org.agentsherpa.model.GlobalMap;
import org.agentsherpa.model.MapLoadException;
import org.agentsherpa.model.SimulatorModel;

public class MapWindow extends JFrame {
    private static final long serialVersionUID = 1168737694067037750L;

    public MapWindow(SimulatorModel simulator) {
        this.setLayout(new BorderLayout());
        this.add(new MapComponent(simulator), BorderLayout.CENTER);
        this.setPreferredSize(new Dimension(400, 400));
        this.setSize(new Dimension(400, 400));
        this.setTitle("Sherpa Map");
    }

    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    URL image = new URL("file:///home/iain/College/Agents/projects/agent-sherpa/src/org/agentsherpa/model/simple_mask.png");
                    GlobalMap map = new GlobalMap(image);
                    SimulatorModel simulator = new SimulatorModel(map);
                    new MapWindow(simulator).setVisible(true);
                }
                catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                catch (MapLoadException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        });
    }

}
